package br.com.portadelivery.app.server;

import java.util.List;

import br.com.portadelivery.app.R;
import br.com.portadelivery.app.model.Usuario;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class UsuarioAdapter extends BaseAdapter {

	private Context contexto;
	private List<Usuario> Lists;
	
	public UsuarioAdapter(Context contexto, List<Usuario> lists) {
		super();
		this.contexto = contexto;
		Lists = lists;
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return Lists.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return Lists.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		Usuario lists = Lists.get(position);
		LayoutInflater inflater = (LayoutInflater) contexto.getSystemService(contexto.LAYOUT_INFLATER_SERVICE);
		View v = inflater.inflate(R.layout.listausuariocustom, null);
		TextView nome = (TextView)v.findViewById(R.id.Nome);
		TextView email = (TextView)v.findViewById(R.id.email);
		nome.setText(lists.getNome());;
		email.setText(lists.getEmail());
		return v;
	}

}
